﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Links.aspx.cs" Inherits="Links" Title="网站链接" %>

<asp:Content ID="Content1" ContentPlaceHolderID="mainContentPlaceHolder" Runat="Server">
<asp:LinqDataSource ID="LinqDataSource1" runat="server" 
	ContextTypeName="Cgd.Shell.Data.CgdShellDataContext" TableName="Links" 
	EnableDelete="True" EnableInsert="True" 
	EnableUpdate="True" OrderBy="DisplayOrder">
</asp:LinqDataSource>

<h2>管理网站链接</h2>
<asp:ListView ID="ListView1" runat="server" DataKeyNames="Id" 
	DataSourceID="LinqDataSource1" InsertItemPosition="FirstItem" 
		oniteminserting="ListView1_ItemInserting" onitemcommand="ListView1_ItemCommand">
<LayoutTemplate>
<div id="itemPlaceholder" runat="server"></div>
</LayoutTemplate>
<ItemTemplate>
<div>
	<h3><%# Eval("Title") %></h3>
	<p class="Summary"><a href='<%# Eval("Url") %>' target="_blank"><%# Eval("Url") %></a></p>
	<p class="Summary"><%# Eval("Summary") %></p>
	<p class="Summary">显示：<asp:CheckBox ID="chkShow" runat="server" Enabled="false" Checked='<%# Eval("Show") %>' /></p>
	<p class="ItemCommand">
		<asp:LinkButton ID="btnMoveUp" runat="server" CommandName="cmd:MoveUp" CommandArgument='<%# Eval("Id") %>' Text="上移"></asp:LinkButton>
		<asp:LinkButton ID="btnMoveDown" runat="server" CommandName="cmd:MoveDown" CommandArgument='<%# Eval("Id") %>' Text="下移"></asp:LinkButton>
		<asp:LinkButton ID="btnEdit" runat="server" CommandName="Edit" Text="编辑"></asp:LinkButton>
		<asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete" OnClientClick="return confirm('确定要删除吗？\n该操作无法撤销。');" Text="删除"></asp:LinkButton>
	</p>
</div>
</ItemTemplate>
<ItemSeparatorTemplate>
<hr />
</ItemSeparatorTemplate>
<EditItemTemplate>
<div class="EditItem">
	<table>
	<tr><td>标题：</td><td><asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("Title") %>' Width="600px"></asp:TextBox></td></tr>
	<tr><td>URL：</td><td><asp:TextBox ID="txtUrl" runat="server" Text='<%# Bind("Url") %>' Width="600px"></asp:TextBox></td></tr>
	<tr><td>描述（鼠标悬浮时显示）：</td><td><asp:TextBox ID="txtSummary" runat="server" TextMode="MultiLine" Text='<%# Bind("Summary") %>' Width="600px"></asp:TextBox></td></tr>
	<tr><td>是否显示：</td><td><asp:CheckBox ID="chkShow" runat="server" Checked='<%# Bind("Show") %>' /></td></tr>
	</table>
	<p class="ItemCommand">
		<asp:LinkButton ID="btnUpdate" runat="server" CommandName="Update" Text="确定"></asp:LinkButton>
		<asp:LinkButton ID="btnCancel" runat="server" CommandName="Cancel" Text="取消"></asp:LinkButton>
	</p>
</div>
</EditItemTemplate>
<InsertItemTemplate>
<div class="NewItem">
	<h3>添加链接</h3>
	<table>
	<tr><td>标题：</td><td><asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("Title") %>' Width="600px"></asp:TextBox></td></tr>
	<tr><td>URL：</td><td><asp:TextBox ID="txtUrl" runat="server" Text='<%# Bind("Url") %>' Width="600px"></asp:TextBox></td></tr>
	<tr><td>描述（鼠标悬浮时显示）：</td><td><asp:TextBox ID="txtSummary" runat="server" TextMode="MultiLine" Text='<%# Bind("Summary") %>' Width="600px"></asp:TextBox></td></tr>
	<tr><td>是否显示：</td><td><asp:CheckBox ID="chkShow" runat="server" Checked='<%# Bind("Show") %>' /></td></tr>
	</table>
	<p class="ItemCommand">
		<asp:LinkButton ID="btnInsert" runat="server" CommandName="Insert" Text="添加"></asp:LinkButton>
		<asp:LinkButton ID="btnCancel" runat="server" CommandName="Cancel" Text="清空"></asp:LinkButton>
	</p>
</div>
</InsertItemTemplate>
</asp:ListView>
</asp:Content>

